package com.situ.javase.day16;

import org.junit.Test;

public class Demo {
	
	
	public static void main(String[] args) {
		short s1 = 1;
		s1 = 22;
		// type mismatch: cannot convert from int to short
		s1 = 2299988;
		// Type mismatch: cannot convert from int to short
		s1 = s1 + 1;
		short s2 = s1 + 1;
	}

	@Test
	public void test() {
		final StringBuffer stringBuffer = new StringBuffer("hello");
		// The final local variable stringBuffer cannot be assigned. 
		// stringBuffer = new StringBuffer("");
		stringBuffer.append("Java");
		System.out.println(stringBuffer);
	}
	
	@Test
	public void test2() {
		StringBuffer stringBuffer = new StringBuffer("Hello");
		fun(stringBuffer);
		System.out.println(stringBuffer);
	}

	private void fun(final StringBuffer stringBuffer) {
		// stringBuffer = new StringBuffer("");
		stringBuffer.append("Java");
		System.out.println(stringBuffer);
	}
	
	@Test
	public void test3() {
		int i = 3;
		f(i);
		System.out.println(i);// 3
	}

	private void f(int i) {
		i = 34;
		System.out.println(i);// 34
	}
	
	
	
}
